import java.io.FileReader;
import java.io.IOException;

import au.com.bytecode.opencsv.CSVReader;


public class loadData {
	public static void main(String[] args){
		int i = 0;
		int a,b,c;
		
		int MAX = 99999;
		
		
		/*int[][] k = { { 1,2,3} , {4,5,6} , {7,8,9}};
		
		for (i=0;i<3;i++)
			for (int j=0;j<3;j++)
				System.out.print(k[i][j] + " ");*/
		
		//this.Lots = new lotInfo[60];
		
		
		try{
			//FileReader r = new FileReader("data/lotinfo.csv");
			//this.N = 100;
			CSVReader reader = new CSVReader(new FileReader("data/lotinfo.csv"));
			
			System.out.println("String[][] data1 = {");
		    String[] nextLine;
		    nextLine = reader.readNext();
		    while ((nextLine = reader.readNext()) != null) {
		        // nextLine[] is an array of values from the line
		        //System.out.println(nextLine[0] + nextLine[1] + "etc...");
		        if (nextLine[3].equals("NULL")) {
		        	a = MAX;
		        } else {
		        	a = Integer.parseInt(nextLine[3]);
		        }
		        if (nextLine[4].equals("NULL")) {
		        	b = MAX;
		        } else {
		        	b = Integer.parseInt(nextLine[4]);
		        }
		        if (nextLine[5].equals("NULL")) {
		        	c = MAX;
		        } else {
		        	c = Integer.parseInt(nextLine[5]);
		        }
		        //System.out.println(i + ", " + Integer.parseInt(nextLine[0]));
		        //Lots[i] = new lotInfo();
		    	//Lots[i].initialize(Integer.parseInt(nextLine[0]), nextLine[1], nextLine[2], a, b, c);
		        System.out.println("\t{\""+Integer.parseInt(nextLine[0])+"\",\""+nextLine[1]+"\",\""+nextLine[2]+"\",\""+a+"\",\""+b+"\",\""+c+"\"},");
		    	i++;
		    }
			
			System.out.println("};");
		}catch(IOException err){
			
		}
		System.out.println("int dataN1 = "+i+";");
		//this.N = i;
		//this.N = 100;
		
		double d;
		
		try{
			CSVReader reader = new CSVReader(new FileReader("data/lotdata.csv"));
			
			int j = 0, k = 0;
			d=0;
			System.out.println("String[][] data2 = {");
			
			String[] nextLine;
			nextLine = reader.readNext();
			while ((nextLine = reader.readNext()) != null) {
				//System.out.println(nextLine[0] + nextLine[1] + "etc...");
				
				//i = findID(Integer.parseInt(nextLine[0]));
				i = Integer.parseInt(nextLine[0]);
				a = Integer.parseInt(nextLine[2]);
				b = Integer.parseInt(nextLine[3]);
				if (!nextLine[5].equals("NULL")){
					d = Double.parseDouble(nextLine[5]);
					k=0;//Lots[i].addRule(0, a, b, d);
					if (nextLine[1].contains("Sat")) k=1;//Lots[i].addRule(1, a, b, d);
					if (nextLine[1].contains("Sun")) k=2;//Lots[i].addRule(2, a, b, d);
				}
				System.out.println("\t{\""+i+"\",\""+nextLine[1]+"\",\""+a+"\",\""+b+"\",\""+d+"\"},");
				j++;
			}
			System.out.println("};");
			System.out.println("int dataN2 = "+j+";");
		}catch(IOException err){
		}
	}
}
